package com.shop.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shop.pojo.pms.Pms_Category_Attr;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//属性分类mapper
public interface Pms_Category_Attr_Mapper extends BaseMapper<Pms_Category_Attr> {
//属性表和分类表
@Select("select p.attr_name,pca.*,pc.name as catelog_name from pms_attr as p inner join pms_category_attr as pca on p.attr_id=pca.attr_id inner join pms_category as pc on pc.cat_id=pca.cat_id ${ew.customSqlSegment}")
    <E extends IPage<Pms_Category_Attr>> E findAttrByCategory(E page, @Param("ew") Wrapper<Pms_Category_Attr> queryWrapper);
    @Select("select p.attr_name,pca.*,pc.name as catelog_name from pms_attr as p inner join pms_category_attr as pca on p.attr_id=pca.attr_id inner join pms_category as pc on pc.cat_id=pca.cat_id ${ew.customSqlSegment}")
    List<Pms_Category_Attr> findAttrByCategoryList(@Param("ew") Wrapper<Pms_Category_Attr> queryWrapper);
}
